package miniprojet.jeux.utils;

import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;

import miniprojet.jeux.stateless.TournoiRemote;

public class Main {
	public static void main(String[] args) {
		Properties jndiProps = new Properties();
//        jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
		jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, 
		"org.jboss.naming.remote.client.InitialContextFactory");
		jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
		// username je sais pas 
		jndiProps.put(Context.SECURITY_AUTHENTICATION, "");
		// password je sais pas
		jndiProps.put(Context.SECURITY_CREDENTIALS, "");
		// create a context passing these properties

		//jndiProps.put("jboss.naming.client.ejb.context", true);
		try {
			Context ctx = new InitialContext(jndiProps);
			TournoiRemote bk=(TournoiRemote)ctx.lookup("TournoiBean/remote");
			System.out.println(bk.getAllEquipes());
			} catch (NamingException ne) {
			ne.printStackTrace();
			}

	}
}